package com.acme.bankapp.domain.bank;

public class CheckingAccount extends AbstractAccount {
	public double overdraft;

	public CheckingAccount(long numer, double balance, double overdraft) {
		if (this.numer >= numer) {
			this.numer++;
		} else {
			this.numer = numer;
		}
		if (this.balance == 0) {
			this.balance = balance;
		}

		if (overdraft <= 0) {
			this.overdraft = 250;

		}

	}

	public CheckingAccount() {

	}

	@Override
	public void withdraw(double amount) {
		if (balance < amount) {
			double sum = balance + overdraft;
			if (sum >= amount) {
				overdraft = sum - amount;
			}
		}
		else {
			balance -= amount;
		}
	}

	
	 public double maximumAmountToWithdraw() {
		 
		 return balance + overdraft;
	 }
}
